package com.example.demo.util;

import java.lang.annotation.Annotation;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
import java.util.Map;

/**
 * 反射工具类
 */
public class ReflectUtil {

    public static void get(Annotation annotation) throws Exception{
        InvocationHandler invocationHandler = Proxy.getInvocationHandler(annotation);

        Field value = invocationHandler.getClass().getDeclaredField("memberValues");
        value.setAccessible(true);
        Map<String, Object> memberValues = (Map<String, Object>) value.get(invocationHandler);

    }

    public static void get22(Class<?> clazz,String fieldName, Class<?extends Annotation> annotationClazz) throws Exception{

        Field field = clazz.getClass().getDeclaredField(fieldName);

        Annotation annotation = field.getDeclaredAnnotation(annotationClazz);
        InvocationHandler invocationHandler = Proxy.getInvocationHandler(annotation);


    }

}
